You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added an import statement for assertFalse from org.junit.jupiter.api.Assertions.
Introduced a new test method shouldReturnEmpstyOptionalWhenFindBySlugIsCalledWithNonExistingSlug to verify behavior when a non-existing article slug is queried.
2, because the PR is focused on adding a single test case and an import statement, which are straightforward changes. The logic within the test is simple and the overall size of the PR is small.
🧪 Relevant tests
Yes
⚡ Possible issues
Typo in Method Name: The method name shouldReturnEmpstyOptionalWhenFindBySlugIsCalledWithNonExistingSlug contains a typo ("Empsty" should be "Empty"). This could potentially cause confusion or misinterpretation of the test purpose.
Correct the typo in the method name from shouldReturnEmpstyOptionalWhenFindBySlugIsCalledWithNonExistingSlug to shouldReturnEmptyOptionalWhenFindBySlugIsCalledWithNonExistingSlug. This will improve readability and prevent any confusion regarding the test's purpose. [important]
Improve the readability and consistency of the assertion.
Consider using assertThat(result).isEmpty(); from AssertJ for better readability and consistency in assertions, assuming AssertJ is used elsewhere in the project.
User user = new User("test@test.com", "test", "123", "", "");
+assertNotNull(user.getEmail());+assertNotNull(user.getUsername());
Maintainability
Correct the spelling mistake and enhance readability in the test method name.
Rename the test method shouldReturnEmpstyOptionalWhenFindBySlugIsCalledWithNonExistingSlug to correct the spelling mistake and improve readability, such as shouldReturnEmptyOptionalWhenFindBySlugIsCalledWithNonExistingSlug.
-User user = new User("test@test.com", "test", "123", "", "");+User testUser = new User("test@test.com", "test", "123", "", "");
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Tests
Description
ArticleQueryServiceTest.javato ensure that querying a non-existing article slug returns an empty Optional.assertFalseto support the new test assertion.Changes walkthrough 📝
ArticleQueryServiceTest.java
Add new test for non-existing article slug querysrc/test/java/io/spring/application/article/ArticleQueryServiceTest.java
assertFalsefromorg.junit.jupiter.api.Assertions.shouldReturnEmpstyOptionalWhenFindBySlugIsCalledWithNonExistingSlugtoverify behavior when a non-existing article slug is queried.